package Book;

//这个类用来存放书
public class BookList{

   private Book[] books = new Book[10];
   private int usedsize;//存储当前书的个数
   //事先通过构造方法  初始化的时候  给数组里面预存3本书 usedsized = 3
   public BookList(){
       books[0] = new Book("三国演义","罗贯中",89,"小说");
       books[1] = new Book("西游记","吴承恩",49,"小说");
       books[2] = new Book("红楼梦","曹雪芹",78,"小说");
       usedsize = 3;
   }
    //将Usedsize封装提供方法供外界访问
    public int getUsedsize() {
        return usedsize;
    }

    public void setUsedsize(int usedsize) {
        this.usedsize = usedsize;
    }

    public Book getPos(int pos){
       return books[pos];
    }
    //将要添加的书籍放入usedSize位置处
    public void setBooks(Book book,int pos){
       books[pos] = book;
    }
}
